package com.lsu.app.mapper;

import com.lsu.app.bean.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 *
 * @description 针对表【menu】的数据库操作Mapper
 * @Date 2023-10-19 11:21:28
 * @author hjj
 */
@Mapper
public interface MenuMapper extends BaseMapper<Menu> {

    @Select("select * from menu where id in(select top_menu_id from role_menu where role_id = #{roleId})")
    List<Menu> getTopMenu(Integer roleId);//获取角色对应的菜单集合
    @Select("select id from role where name = #{roleName}")
    Integer getRoleIdByRole(String roleName);//获取角色id

    @Select("select * from menu where up_id = #{menuId}")
    List<Menu> getMenusByTopMenusId(Integer menuId);//根据父级菜单获取子集菜单

}




